package com.cabal.job;

import com.cabal.ssh.SSHConnectionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class WarStartSSHJob {

	@Autowired
	private SSHConnectionService sshConnectionService;

	// 1-7或是SUN-SAT(1是SUN)
	/*@Scheduled(cron="${cabal-war-start-ssh-cron-1:0 0 3 * * ?}")
	public void warSendReward1() {
		log.info("自动开启下午国战定时任务开始......");
		sshConnectionService.commandSSH("service WorldSvr_01_08 restart");
		log.info("自动开启下午国战定时任务结束......");
	}*/

	@Scheduled(cron="${cabal-war-start-ssh-cron-2:0 0 3 * * ?}")
	public void warSendReward2() {
		log.info("自动开启晚上国战定时任务开始......");
		sshConnectionService.commandSSH("service WorldSvr_01_08 restart");
		log.info("自动开启晚上国战定时任务结束......");
	}
}